import request from "@/utils/request";

export function page(data) {
  return request({
    url: "/v1/device/page",
    method: "get",
    params: data
  });
}

export function pagePassWordUpdate(data) {
  return request({
    url: "/v1/device/page2",
    method: "get",
    params: data
  });
}

export function groupPage(data) {
  return request({
    url: "/v1/device/group/page",
    method: "get",
    params: data
  });
}

export function get(data) {
  return request({
    url: "/v1/device/get",
    method: "get",
    params: data
  });
}

export function getAppStatus(data) {
  return request({
    url: "/v1/device-app-status/page",
    method: "get",
    params: data
  });
}
// 设备重启命令下发
export function commandIssue(data) {
  return request({
    url: "/v1/device-restart/commandIssue",
    method: "post",
    data: data
  });
}
// 设备重启-数据查询
export function commandIssueResp(data) {
  return request({
    url: "/v1/device-restart/page",
    method: "GET",
    params: data
  });
}
// 设备重启-数据查询---针对同步信息的
export function commandIssueRespResult(data) {
  return request({
    url: "/v1/device-state-result/page",
    method: "GET",
    params: data
  });
}

export function getStatusById(id) {
  return request({
    url: "/v1/device-app-status/get/" + id,
    method: "get"
  });
}

export function statusCommandIssue(data) {
  return request({
    url: "/v1/device-app-status/commandIssue",
    method: "post",
    data: data
  });
}
// 查看状态
export function statusCommandIssueResp(data) {
  return request({
    url: "/v1/device-app-status/page",
    method: "GET",
    params: data
  });
}

// 同步设备信息 -命令下发
export function syncCommandIssue(data) {
  return request({
    url: "/v1/device-info/commandIssue",
    method: "post",
    data: data
  });
}

// 网络信息接口查询
export function networkInfoCommandIssue(data) {
  return request({
    url: "/v1/networkInfo/commandIssue",
    method: "post",
    data: data
  });
}

export function getByMessageId(messageId) {
  return request({
    url: "/v1/networkInfo/getByMessageId/" + messageId,
    method: "GET"
  });
}




//设备详情中的容器列表
export function containerList(data) {
  return request({
    url: "/v1/container/list",
    method: "get",
    params: data
  });
}

//容器文件名称  

export function fileName(id) {
  return request({
    url: "/v1/file/get/" + id,
    method: "get"
  });
}



//
//根据设备id容器id查询应用
export function getApp(data) {
  return request({
    url: "/v1/appEntity/getApp",
    method: "get",
    params: data
  });
}



//  停止 启动等   应用 


export function singleCommand(data) {
  return request({
    url: "/v1/appEntity/singleCommand",
    method: "post",
    data
  });
}
//根据返回的id 查询

export function getAppId(id) {
  return request({
    url: "/v1/app/" + id,
    method: "get"
  });
}

//修改容器

export function containerUpdate(data) {
  return request({
    url: "/v1/container/containerResize",
    method: "post",
    data
  });
}

//获取最新容器信息
export function getDeviceNew(id) {
  return request({
    url: "/v1/container/containerStatus/"+ id,
    method: "get"
  });
}



//容器停止


export function containerStop(id) {
  return request({
    url: "/v1/container/stop/" + id,
    method: "get"
  });
}

//卸载


export function containerUninstall(id) {
  return request({
    url: "/v1/container/uninstall/" + id,
    method: "get"
  });
}

//启动


export function containerStart(id) {
  return request({
    url: "/v1/container/start/" + id,
    method: "get"
  });
}


//app状态查询

export function appStatusCheck(data) {
  return request({
    url: "v1/appEntity/singleCommand",
    method: "post",
    data
  });
}


//故障告警
export function appAlarm(id) {
  return request({
    url: "v1/alarm/" + id,
    method: "get"
  });
}

//当前报警

export function nowAlarm(data) {
  return request({
    url: "v1/alarm/now",
    method: "get",
    params: data
  });
}


//历史

export function historyAlarm(data) {
  return request({
    url: "v1/alarm/history",
    method: "get",
    params: data
  });
}
//当前告警总数 


export function nowCount() {
  return request({
    url: "v1/alarm/nowCount",
    method: "get"
  });
}

//清除告警  
export function clearAlarm(id) {
  return request({
    url: "v1/alarm/clean/" + id,
    method: "delete"
  });
}


//删除告警
export function deleteAlarm(id) {
  return request({
    url: "v1/alarm/" + id,
    method: "delete"
  });
}

